package org.fas.ui
{
	import flash.display.Sprite;
	
	import org.foxas.classarray.StringArray;

	public class FButtonGroup extends Sprite
	{
		public function FButtonGroup(_nameArray:StringArray,_clickHandle:Function)
		{
			super();
		}
		private function onMdown(_e:MouseEvent):void{
			var _name:String = _e.currentTarget.name;
			var _index:int = Number(_name.replace("btn_",""));
			this.selectedIndex = _index;
			this.actionListener(_index);
		}
		private var selectedIndex_r:int = 0;
		public function set selectedIndex(_v:int):void{
//			var i:int =0 ;
//			while(i<this.numChildren){
//				(this.getChildAt(i) as Button).filters = null;
//				i++;
//			}
			(this.getChildAt(this.selectedIndex_r) as Sprite).filters = null;
			this.selectedIndex_r = _v;
			(this.getChildAt(this.selectedIndex_r) as Sprite).filters = filtersArr;
		}
		public function get selectedIndex():int{
			return selectedIndex_r;
		}
		private function btnFormat():void{
			var i:int = 0;
			while(i<this.btns.length){
				this.btns[i].filters = null;
				i++;
			}
			this.btns[this.selectedIndex].filters = filtersArr;
		}
	}
}